unsigned int maximo(unsigned char b, unsigned char g, unsigned char r) {
        unsigned int result = 0;        
        if(b > g){result = b;}
        else{result = g;}
        if(r > result){result = r;}
	return result;
        }

void gris_epsilon_inf_c(unsigned char *src, unsigned char *dst, int h, int w, int src_row_size, int dst_row_size) {
   unsigned char *pixel;
    unsigned char blue, red, green;   
    unsigned int vMono;   
    int i;
    pixel = src;	   
    int stp = src_row_size * h;
    for(i = 0; i < stp;i = i + 3){
   	 red = *(pixel+2);
   	 green = *(pixel+1);
   	 blue = *(pixel);
   	vMono = maximo(blue, green, red);	
    	if(vMono > 0xFF){ *dst = (unsigned char) 0xFF;}
    	else{*dst = (unsigned char)vMono;}
    	*dst = (unsigned char)vMono;
	dst = dst + 1;
	pixel = pixel +3;
    }   
}
